package com.jtlrm.ckd.mvp.model;

import com.base.sdk.base.model.BaseModel;
import com.base.sdk.base.net.LifeCycleEvent;
import com.google.gson.JsonObject;
import com.jtlrm.ckd.net.RetrofitUtil;

import io.reactivex.Observer;
import io.reactivex.subjects.PublishSubject;

public class SuiFangPaiBanModel extends BaseModel {

    public void querySuiFangList(String keyword, String visitTime, int PageIndex, int PageSize, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("keyword", keyword);
        jsonObject.addProperty("visitTime", visitTime);
        jsonObject.addProperty("PageIndex", PageIndex);
        jsonObject.addProperty("PageSize", PageSize);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().querySuiFangPaiBan(jsonObject), observer, lifecycleSubject);
    }

    public void querySuiFangList(String keyword, String visitTime, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("keyword", keyword);
        jsonObject.addProperty("visitTime", visitTime);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().querySuiFangPaiBanList(jsonObject), observer, lifecycleSubject);
    }

    public void queryAddSuiFangList( String visitTime, int PageIndex, int PageSize, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("visitTime", visitTime);
        jsonObject.addProperty("PageIndex", PageIndex);
        jsonObject.addProperty("PageSize", PageSize);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryAddSuiFang(jsonObject), observer, lifecycleSubject);
    }

    public void addSuiFang( String visitTime, String ids, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("visitTime", visitTime);
        jsonObject.addProperty("ids", ids);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().addSuiFangPaiBan(jsonObject), observer, lifecycleSubject);
    }

    public void changeSuiFang(String visitTime, String id, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("visitTime", visitTime);
        jsonObject.addProperty("id", id);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().changeSuiFangPaiBan(jsonObject), observer, lifecycleSubject);
    }

    public void deleteSuiFang(String patientId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("patientId", patientId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().deleteSuiFangPaiBan(jsonObject), observer, lifecycleSubject);
    }
}
